﻿using System.Collections.Generic;

namespace InstantWatch {
	public class AggregateProxy : IProxy {

		private List<IProxy> Proxies { get; set; }

		public AggregateProxy(NetflixProxy np, RssProxy hp) {
			Proxies = new List<IProxy>();
			Proxies.Add(np);
			Proxies.Add(hp);
		}

		#region IProxy Members

		public IEnumerable<QueueItem> GetUserQueue(int count) {

			List<QueueItem> items = new List<QueueItem>();

			foreach (IProxy p in this.Proxies) {
				items.AddRange(p.GetUserQueue(count));
			}

			return items;
		}

		public void RequestAuthorization() {
			Proxies.ForEach(p => p.RequestAuthorization());
		}

		#endregion
	}
}
